#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 1e6 + 10;
ll a[N];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n; cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	if (n == 1) {
		cout << "Yes" << endl;
		cout << 0 << endl;
		return 0;
	}
	ll i = 1;
	int f = 0;
	ll ans = 0;
	while (i < n) {
		i += a[i];
		ans++;
		if (i == n) {
			f = 1;
			break;
		}
		if (i > n) break;
	}
	if (f) cout << "Yes" << endl;
	else cout << "No" << endl;
	cout << ans << endl;
	return 0;
}